package com.pjh.shitang.utils.helpers;

import java.util.Random;

/**
 * @author yueyinghaibao
 * @date 2022/4/20
 */
public class RandomAccessKey {

    private static final String CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static final Random RANDOM = new Random();

    public static String getOneAccessKey(int len) {
        StringBuilder sb = new StringBuilder();
        for(int i = 0;i < len;i++) {
            sb.append(CHARSET.charAt(Math.abs(RANDOM.nextInt() % CHARSET.length())));
        }
        return sb.toString();
    }
}
